<?php if (!defined('THINK_PATH')) exit(); /*a:1:{s:72:"D:\WWW\ZL\blog\public/../application/admin\view\article\articleSave.html";i:1564449309;}*/ ?>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="stylesheet" type="text/css" href="__STATIC_ADMIN__/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="__STATIC_ADMIN__/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css" href="__STATIC_ADMIN__/css/iconfont.css" />
<link rel="stylesheet" type="text/css" href="__STATIC_ADMIN__/css/style.css" />
<link rel="stylesheet" type="text/css" href="__STATIC_ADMIN__/css/icheck.css" />
<title>添加权限 - 权限管理</title>
</head>
<body>
<article class="page-container">
	<form class="form form-horizontal" id="form-rule-add" method="post" action="<?php url('rule/ruleAdd')?>">
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>文章标题：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="<?php echo $one['title']?>" placeholder="请输入文章标题" id="title" name="title">
			</div>
		</div>


		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>选择标签：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<dl class="permission-list">
					<dt>
						<label>
							<input type="checkbox" value="1"  id="user-Character-1">
							请选择标签</label>
					</dt>
					<dd>
						<dl class="cl permission-list2">
					<dd>
						<?php foreach($tag_list as $v){?>
						<label class="">
							<input type="checkbox" value="<?php echo $v['id']?>" name="tag_ids[]" <?php  echo in_array($v['id'],$tag_ids) ? 'checked' : ''?> id="user-Character-1-0-0">
							<?php echo $v['tag_name']?>
						</label>
						<?php } ?>
					</dd>
				</dl>
				</dd>
				</dl>
			</div>
		</div>

		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>文章封面：</label>
			<div class="formControls col-xs-8 col-sm-9"> <span class="btn-upload form-group">
				<input class="input-text upload-url" type="text" name="image" id="uploadfile" readonly nullmsg="请上传封面！" style="width:200px">
					<a href="javascript:void();" class="btn btn-primary radius upload-btn"><i class="Hui-iconfont">&#xe642;</i> 浏览文件</a>
					<input type="file" name="image"  class="input-file">
				</span>
			</div>
		</div>

		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>文章原图：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<img src="<?php echo '/uploads/'.$one['image']?>">
			</div>
		</div>

		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3">上级分类：</label>
			<div class="formControls col-xs-8 col-sm-9"> <span class="select-box" style="width:150px;">
		<select class="select" name="type_id" size="1">
			<?php foreach($type_list as $v){?>
				<option value="<?php echo $v['id']?>" <?php echo $v['id'] == $one['type_id'] ? 'selected':''?>><?php echo str_repeat('&nbsp',$v['deep']*4).$v['type_name']?></option>
			<?php } ?>
		</select>
		</span> </div>
		</div>

		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>编辑作者：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="<?php echo $one['author']?>" placeholder="" id="author" name="author">
			</div>
		</div>


		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>文章内容：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<textarea id="editor" style="height: 500px;" name="content"><?php echo $one['content']?></textarea>
			</div>
		</div>
		<div class="row cl">
			<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
				<input type="hidden" name="id" value="<?php echo $one['id']?>">
				<input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
			</div>
		</div>
	</form>
</article>

<!--_footer 作为公共模版分离出去--> 
<script type="text/javascript" src="__STATIC_ADMIN__/js/jquery.min.js"></script>
<script type="text/javascript" src="__STATIC_ADMIN__/js/layer.js"></script>
<script type="text/javascript" src="__STATIC_ADMIN__/js/jQuery.Form.js"></script>
<script type="text/javascript" src="__STATIC_ADMIN__/js/H-ui.min.js"></script>
<script type="text/javascript" src="__STATIC_ADMIN__/js/H-ui.admin.js"></script>
<!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="__STATIC_ADMIN__/js/jquery.validate.js"></script>
<script type="text/javascript" src="__STATIC_ADMIN__/js/validate-methods.js"></script>
<script type="text/javascript" src="__STATIC_ADMIN__/js/messages_zh.js"></script>
<!--引入编辑器-->
<script type="text/javascript" charset="utf-8" src="/static/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="/static/ueditor/ueditor.all.min.js"> </script>
<script type="text/javascript" charset="utf-8" src="/static/ueditor/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript">
	var ue = UE.getEditor('editor');
	$(".permission-list dt input:checkbox").click(function(){
		$(this).closest("dl").find("dd input:checkbox").prop("checked",$(this).prop("checked"));
	});
	$(".permission-list2 dd input:checkbox").click(function(){
		var l =$(this).parent().parent().find("input:checked").length;
		var l2=$(this).parents(".permission-list").find(".permission-list2 dd").find("input:checked").length;
		if($(this).prop("checked")){
			$(this).closest("dl").find("dt input:checkbox").prop("checked",true);
			$(this).parents(".permission-list").find("dt").first().find("input:checkbox").prop("checked",true);
		}
		else{
			if(l==0){
				$(this).closest("dl").find("dt input:checkbox").prop("checked",false);
			}
			if(l2==0){
				$(this).parents(".permission-list").find("dt").first().find("input:checkbox").prop("checked",false);
			}
		}
	});
	$(function(){
		$("#form-rule-add").validate({
			rules:{
				title:{
					required:true,
				},
				author:{
					required:true,
				},
				type_id:{
					required:true,
				},

			},
			submitHandler:function(form){
				/**
				 * 成功之后的回调函数
				 * @type {{success: options.success}}
                 */
				var options = {
					success: function (data) {
						if(data.code==10000){
							layer.msg(data.msg,{icon:1,time:1000});
							setInterval("closeWindow()",1000);
						}else{
							layer.msg(data.msg,{icon:5,time:1000});
						}
					}
				};
				$(form).ajaxSubmit(options);
			}
		});
	});
	function closeWindow(){
		var index = parent.layer.getFrameIndex(window.name);
		window.parent.location.reload();
	}
</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>